package xq.gwt.mvc.controller;

import xq.gwt.mvc.model.IntegerPropertyModel;
import xq.gwt.mvc.view.IntegerPropertyView;

public class IntegerPropertyController extends AbstractPropertyController {

	protected IntegerPropertyModel integerModel;
	protected IntegerPropertyView integerView;
	
	public IntegerPropertyController(IntegerPropertyView integerView){
		super(integerView);
		this.integerView = integerView;
	}
	
	public void setPropertyModel(IntegerPropertyModel integerModel){
        this.integerModel = integerModel;
        super.setPropertyModel(integerModel);        
    }
	
	@Override
	public void updateModel() {
		if (integerModel != null)
			integerModel.setValue(integerView.getInteger());
	}

	@Override
	public void updateView() {
		if (integerView != null)
			integerView.setInteger(integerModel.getValue());
	}

}
